package com.project.m.api.busi.db.repo.transaction;

import com.project.m.api.busi.db.entity.hicatcard.transaction.TTransaction;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;

public interface TransactionRepo extends JpaRepository<TTransaction, Long>, JpaSpecificationExecutor<TTransaction> {

    List<TTransaction> findByUserIdAndEnableOrderByCreateTimeDesc(Long userId, Boolean enable);

    List<TTransaction> findByUserIdAndEnable(Long userId, Boolean enable, Pageable pageable);

    List<TTransaction> findByUserIdAndMerchantIdAndEnable(Long userId, Long merchantId, Boolean enable,
                                                          Pageable pageable);

    List<TTransaction> findByMerchantIdAndEnable(Long merchantId, Boolean enable, Pageable pageable);

    List<TTransaction> findByMerchantIdAndTransactionOrderAndEnable(Long merchantId, String transactionOrder, Boolean enable);
}
